
$(document).ready(function(){
    $('.btnn').on('click',function(){
        var id = $(this).attr('data-id');

         layer.confirm('本月是否按时还款？', {
            btn: ['是','否'] //按钮
         }, function () {
             $.ajax({
                 url: '/finance/state/yes/' + id,
                 type: 'post',
                 headers: {
                     'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                 },
                 dataType: 'json',
                 success: function (json) {
                     layer.msg('已时还款',{
                        time:2000
                     });
                     setTimeout(function () {
                         window.location.reload();
                     }, 2000);
                 }
             });
         }, function () {
             $.ajax({
                 url: '/finance/state/no/' + id,
                 type: 'post',
                 headers: {
                     'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                 },
                 dataType: 'json',
                 success: function (json) {
                     layer.msg('未按时还款',{
                         time:2000
                     });
                     setTimeout(function () {
                         window.location.reload();
                     }, 2000);
                 }
             });
         });
    });


});

